console: prevent internal timers storage from growing#3562
console: prevent internal timers storage from growing#3562narqo wants to merge 1 commit intonodejs:masterfrom
Conversation
|
Changes LGTM, although a regression test would be nice. This is a behavior change (semver-major) that gets us in line with what Chrome does. |
|
Agree with @cjihrig. A test is necessary. Otherwise LGTM though |
|
@cjihrig @evanlucas the only test I can imagine is one that checks internal |
|
yea I would say just call |
69162e1 to
d4a62d7
Compare
|
I have added a test which verifies that |
|
Should probably use |
test/parallel/test-console.js
Outdated
There was a problem hiding this comment.
Actually, please make this const too.
d4a62d7 to
3a171f9
Compare
|
@cjihrig yep! |
|
@cjihrig @evanlucas Can you explain why this is semver-major? |
|
Currently, you can reuse a timer, for example after each iteration of a loop. With this change you would have to create a new timer each time. |
|
@cjihrig do you mean the cases like this: console.time('label');
console.timeEnd('label');
console.timeEnd('label');
console.timeEnd('label'); |
|
Yes. I'd be willing to bet there are people out there relying on that behavior. |
|
To be honest I've never thought about such usecase. At least Blink's implementation of |
|
@Fishrock123 did we decide to move forward with this change? |
+1 for this change, a |
|
@narqo could you rebase this please. |
The instance of `Console` class doesn't remove links to arrays that come from hrtimer after `timeEnd` had been called.
3a171f9 to
474c066
Compare
|
🆙 |
|
LGTM We may also want to stop throwing on |
Currently, console timers that have been ended with timeEnd() are not removed. This has the potential to leak memory. This commit deletes ended timers from the containing Map. PR-URL: #3562 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
|
Thanks! Landed in a5cce79 |
Unintended functionality was removed from console.endTime by nodejs#3562. Prior to that, you could call console.endTime multiple times for the same label.
Unintended functionality was removed from console.endTime by #3562. Prior to that, you could call console.endTime multiple times for the same label. PR-URL: #6454 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Robert Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Jeremy Whitlock <jwhitlock@apache.org>
Unintended functionality was removed from console.endTime by #3562. Prior to that, you could call console.endTime multiple times for the same label. PR-URL: #6454 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Robert Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Jeremy Whitlock <jwhitlock@apache.org>
Unintended functionality was removed from console.endTime by nodejs#3562. Prior to that, you could call console.endTime multiple times for the same label. PR-URL: nodejs#6454 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Robert Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Jeremy Whitlock <jwhitlock@apache.org>
The instance of
Consoleclass doesn't remove links to arrays that come from hrtimer aftertimeEndhad been called.As far as I understand, such links won't be collected by v8's gc.